/*
 * FinanceRequestListener.java
 *
 * Created on 8 de Julho de 2007, 12:16
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package br.unifor.finance.presentation.listeners;

import br.unifor.finance.presentation.webconfig.WebConfigReader;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Leonardo
 */
public class FinanceRequestListener implements ServletRequestListener {
  
  public void requestDestroyed(ServletRequestEvent sre) {
  }

  public void requestInitialized(ServletRequestEvent sre) {
    HttpSession session = 
            ((HttpServletRequest) sre.getServletRequest()).getSession(false);
    //
    String servletUrl = 
            ((HttpServletRequest) sre.getServletRequest()).getServletPath();
    if(session != null) {
      ((WebConfigReader) session.getAttribute("webConfigReader")).setServletUrl(servletUrl);
    }
  }
  
}
